{{include_file name='public/header' title='项目管理'}}
<style>
    body {
        background-color: #ffffff;
    }
</style>
</head>

<body>

<div class="container">

    <!-- /.row -->
    <div class="row">
        <form id="js_transferProjectForm" role="form" action="{{url('project/transfer','','','json')}}" method="post">
            <input type="hidden" class="form-control" name="id" value="{{$project.id}}">

            <div class="alert alert-dismissable alert-warning">
                <i class="fa fa-fw fa-info-circle"></i>
                只能转让给项目成员，转让后与该项目不再有任何关系，如果要加入需要重新申请，请谨慎操作!
            </div>

            <div class="form-group">
                <label for="recipient-name" class="control-label">转让项目:</label>
                <input type="text" class="form-control" value="{{$project.title}}" placeholder="必填" readonly>
            </div>

            <div class="form-group">
                <label for="recipient-name" class="control-label">登录密码:</label>
                <input type="text" class="form-control" name="password" value="" placeholder="重要操作，请输入登录密码" datatype="*" nullmsg="请输入登录密码!">
            </div>

            <div class="form-group">
                <label for="" class="control-label">转让给:</label>

                <select class="form-control" name="user_id" data-live-search="true">
                    {{foreach $members as $member}}
                    {{$user_id = $member.user_id}}
                    <option value="{{$user_id}}">{{_uri('user', $user_id, 'name')}}({{_uri('user', $user_id, 'email')}})</option>
                    {{foreachelse}}
                    <option value="0">暂无成员</option>
                    {{/foreach}}
                </select>

            </div>

            <input type="hidden" id="js_submit" value="提交">

        </form>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /#wrapper -->

<script>

    $(function(){

        //验证表单
        var projectModal = $(window.parent.document).find('#js_transferProjectModal');

        $("#js_transferProjectForm").validateForm({
            submitBtn: '#js_submit',
            before:function () {
                // iframe父级提交按钮禁用
                projectModal.find(".js_submit").attr("disabled", "disabled").text('提交中..');
            },
            success:function () {
                parent.location.reload();
            },
            error:function () {
                // iframe父级提交按钮激活
                projectModal.find(".js_submit").text('重新提交').removeAttr("disabled");

            }
        });

    });


</script>

{{include_file name='public/footer'}}
